@extends('admin.layout')
@section('title', $title)

@section('content')
 <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                文章管理
                <small>在这里, 你可以添加你的文章
                @if(session('info'))
                    <span id="info" class="text-red">{{session('info')}}</span>
                @endif
                </small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url('/admin/index')}}"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="{{ url('/admin/article') }}">文章管理</a></li>
                <li class="active">添加</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速添加文章</h3>

                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/articlecategory')}} " method="post">
                        	{{ csrf_field()}}
                            <div class="box-body">
	                            @if (count($errors) > 0)
								    <div class="alert alert-danger">
								        <ul>
								            @foreach ($errors->all() as $error)
								                <li>{{ $error }}</li>
								            @endforeach
								        </ul>
								    </div>
								@endif
                                <div class="form-group">
                                    <label >父文章</label>
                                    <select name="pid" class="form-control">
                                        <option value="0">根类</option>
                                        @foreach($data as $row)
                                        <option value="{{$row -> id}}">{{$row -> name}}</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">文章名</label>
                                    <input type="text" class="form-control" value="{{ old('name')}}" name="name" id="exampleInputEmail1"
                                           placeholder="请输入文章名" required="required">
                                </div>
                            </div><!-- /.box-body -->
                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">添加</button>
                            </div>
                        </form>
                    </div><!-- /.box -->

                    <!-- Form Element sizes -->
                </div><!--/.col (left) -->
                <!-- right column -->
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    <script type="text/javascript">

        window.onload = function()
        {
            $('#info').fadeOut(1000);
        }

    </script>
@endsection